@extends('main')

@section('tip', '标签 '.$tag->name)

@section('content')

<div class="row">
    <div class="col-md-9">
        <table class="table">
            <thead>
                <tr>
                    <th>#</th>
                    <th>博文名称</th>
                    <th>包含标签</th>
                </tr>
            </thead>
            <tbody>
            @foreach($tag->post as $post)
                <tr>
                    <td>{{ $post->id }}</td>
                    <td>
                        {!! Html::linkRoute('blog.show', $post->title, $post->slug) !!}
                    </td>
                    <td>
                        @foreach($post->tag as $t)
                        <span class="label label-default">{{ $t->name }}</span>
                        @endforeach
                    </td>
                </tr>
            @endforeach
            </tbody>

        </table>
    </div>

    <div class="col-md-3">
    <div class="panel panel-default">
        <div class="panel-body">
        <h3>标签名称:{{ $tag->name }}</h3>
        <h3>博文数量:{{ $tag->post()->count() }}</h3>
        {!! Form::model($tag, ['route'=>['tag.destroy', $tag->id], 'method'=>'DELETE']) !!}
        {!! Form::submit('移除标签', ['class'=>'btn btn-primary btn-block', 'style'=>'margin-top:20px']) !!}
        {!! Form::close() !!}
        {!! Html::linkRoute('tag.index', '所有标签', null, ['class'=>'btn btn-success btn-block', 'style'=>'margin-top:10px']) !!}
        </div>
    </div>
    </div>
</div>

@endsection